<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>订单支付 - 淘乐乐</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Microsoft YaHei', sans-serif;
        }

        body {
            background-color: #f5f5f5;
        }

        /* 导航栏样式 */
        .main-nav {
            background: #ff3c3c;
            padding: 15px 0;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 15px;
        }

        .nav-content {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .logo {
            color: #fff;
            font-size: 24px;
            font-weight: bold;
            text-decoration: none;
        }

        /* 支付主体内容 */
        .payment-container {
            max-width: 800px;
            margin: 30px auto;
            background: white;
            border-radius: 10px;
            box-shadow: 0 2px 15px rgba(0,0,0,0.1);
            padding: 30px;
        }

        .order-info {
            border-bottom: 1px solid #eee;
            padding-bottom: 20px;
            margin-bottom: 20px;
        }

        .order-title {
            font-size: 20px;
            color: #333;
            margin-bottom: 15px;
        }

        .order-amount {
            font-size: 24px;
            color: #ff3c3c;
            font-weight: bold;
            margin: 10px 0;
        }

        .order-number {
            color: #666;
            font-size: 14px;
        }

        /* 支付方式选择 */
        .payment-methods {
            margin: 20px 0;
        }

        .method-title {
            font-size: 18px;
            margin-bottom: 15px;
            color: #333;
        }

        .payment-options {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 15px;
        }

        .payment-option {
            border: 2px solid #eee;
            border-radius: 8px;
            padding: 15px;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .payment-option.selected {
            border-color: #ff3c3c;
            background: #fff5f5;
        }

        .payment-option:hover {
            border-color: #ff3c3c;
        }

        .payment-option img {
            width: 30px;
            height: 30px;
            object-fit: contain;
        }

        /* 支付按钮 */
        .payment-action {
            margin-top: 30px;
            text-align: center;
        }

        .pay-btn {
            background: #ff3c3c;
            color: white;
            border: none;
            padding: 12px 40px;
            border-radius: 25px;
            font-size: 18px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .pay-btn:hover {
            background: #ff5555;
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(255,60,60,0.3);
        }

        /* 倒计时样式 */
        .payment-timer {
            text-align: center;
            margin: 20px 0;
            color: #666;
        }

        .timer {
            color: #ff3c3c;
            font-weight: bold;
        }

        /* 订单详情 */
        .order-details {
            background: #f9f9f9;
            border-radius: 8px;
            padding: 15px;
            margin: 20px 0;
        }

        .detail-item {
            display: flex;
            justify-content: space-between;
            margin-bottom: 10px;
            color: #666;
        }

        .detail-item:last-child {
            margin-bottom: 0;
            padding-top: 10px;
            border-top: 1px dashed #ddd;
            color: #333;
            font-weight: bold;
        }

        /* 二维码支付区域 */
        .qr-payment {
            display: none;
            text-align: center;
            margin-top: 20px;
        }

        .qr-code {
            width: 200px;
            height: 200px;
            margin: 0 auto;
            background: #f5f5f5;
            padding: 10px;
            border-radius: 8px;
        }

        .qr-code img {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }

        .qr-tip {
            margin-top: 10px;
            color: #666;
            font-size: 14px;
        }
    </style>
</head>
<body>
    <!-- 导航栏 -->
    <nav class="main-nav">
        <div class="container">
            <div class="nav-content">
                <a href="淘乐乐商城.html" class="logo">淘乐乐</a>
                <div class="user-info">
                    <span style="color: white;">订单支付</span>
                </div>
            </div>
        </div>
    </nav>

    <!-- 支付主体内容 -->
    <div class="payment-container">
        <!-- 订单信息 -->
        <div class="order-info">
            <h2 class="order-title">订单支付</h2>
            <div class="order-amount">¥8999.00</div>
            <div class="order-number">订单号：2024030801</div>
        </div>

        <!-- 订单详情 -->
        <div class="order-details">
            <div class="detail-item">
                <span>商品金额</span>
                <span>¥8999.00</span>
            </div>
            <div class="detail-item">
                <span>优惠券</span>
                <span>-¥100.00</span>
            </div>
            <div class="detail-item">
                <span>运费</span>
                <span>¥0.00</span>
            </div>
            <div class="detail-item">
                <span>实付金额</span>
                <span>¥8899.00</span>
            </div>
        </div>

        <!-- 支付倒计时 -->
        <div class="payment-timer">
            请在 <span class="timer" id="timer">14:59</span> 内完成支付
        </div>

        <!-- 支付方式选择 -->
        <div class="payment-methods">
            <h3 class="method-title">选择支付方式</h3>
            <div class="payment-options">
                <div class="payment-option" onclick="selectPayment(this, 'alipay')">
                    <img src="https://img.alicdn.com/imgextra/i4/O1CN01XCiY1B1px3DnUf9jE_!!6000000005421-2-tps-200-200.png" alt="支付宝">
                    <span>支付宝</span>
                </div>
                <div class="payment-option" onclick="selectPayment(this, 'wechat')">
                    <img src="https://res.wx.qq.com/a/wx_fed/assets/res/OTE0YTAw.png" alt="微信支付">
                    <span>微信支付</span>
                </div>
                <div class="payment-option" onclick="selectPayment(this, 'unionpay')">
                    <img src="https://www.unionpayintl.com/upload/images/logo.png" alt="银联支付">
                    <span>银联支付</span>
                </div>
            </div>
        </div>

        <!-- 二维码支付区域 -->
        <div class="qr-payment" id="qrPayment">
            <div class="qr-code">
                <img src="https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=example" alt="支付二维码">
            </div>
            <p class="qr-tip">请使用手机扫描二维码完成支付</p>
        </div>

        <!-- 支付按钮 -->
        <div class="payment-action">
            <button class="pay-btn" onclick="startPayment()">立即支付</button>
        </div>
    </div>

    <script>
        // 选择支付方式
        function selectPayment(element, method) {
            // 移除其他选项的选中状态
            document.querySelectorAll('.payment-option').forEach(option => {
                option.classList.remove('selected');
            });
            // 添加选中状态
            element.classList.add('selected');
            
            // 如果是微信支付或支付宝，显示二维码
            const qrPayment = document.getElementById('qrPayment');
            if (method === 'wechat' || method === 'alipay') {
                qrPayment.style.display = 'block';
            } else {
                qrPayment.style.display = 'none';
            }
        }

        // 开始支付
        function startPayment() {
            const selected = document.querySelector('.payment-option.selected');
            if (!selected) {
                alert('请选择支付方式');
                return;
            }
            // 这里可以添加实际的支付逻辑
            alert('正在跳转到支付页面...');
            // 支付成功后跳转到订单页面
            setTimeout(() => {
                location.href = '订单界面.html';
            }, 1500);
        }

        // 倒计时功能
        function startTimer(duration) {
            let timer = duration;
            const timerElement = document.getElementById('timer');
            
            const interval = setInterval(() => {
                const minutes = parseInt(timer / 60, 10);
                const seconds = parseInt(timer % 60, 10);

                timerElement.textContent = 
                    minutes.toString().padStart(2, '0') + ':' + 
                    seconds.toString().padStart(2, '0');

                if (--timer < 0) {
                    clearInterval(interval);
                    alert('支付超时，请重新下单');
                    location.href = '购物车.html';
                }
            }, 1000);
        }

        // 启动15分钟倒计时
        startTimer(15 * 60);
    </script>
</body>
</html> 